package com.csg.web.dto;

import com.csg.web.validation.CustomConstraint;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Past;
import java.util.Date;

/**
 * demo用户对象
 *
 * @author george
 */
@Data
public class User {

    /**
     *
     */
    @JsonView(UserSimpleView.class)
    private Long id;

    /**
     * 用户名
     */
    @CustomConstraint(message = "自定义测试校验器")
    @JsonView(UserSimpleView.class)
    private String username;

    /**
     * 密码
     */
    @NotBlank
    @JsonView(UserDetailView.class)
    private String password;

    /**
     * 生日
     */
    @Past
    @JsonView(UserSimpleView.class)
    private Date birthday;

    public interface UserSimpleView {
    }

    public interface UserDetailView extends UserSimpleView {
    }
}
